"use strict";
var Stack = /** @class */ (function () {
    function Stack() {
        this.stack = [];
    }
    // 入栈
    Stack.prototype.push = function (item) {
        return this.stack.push(item);
    };
    // 出栈
    Stack.prototype.pop = function () {
        return this.stack.pop();
    };
    //  获取栈顶元素
    Stack.prototype.peek = function () {
        return this.stack[this.stack.length - 1];
    };
    //  获取栈的长度
    Stack.prototype.length = function () {
        return this.stack.length;
    };
    //  栈是否为空
    Stack.prototype.isEmpty = function () {
        return this.stack.length === 0;
    };
    //  toString
    Stack.prototype.toString = function () {
        var stackString = '';
        for (var index = 0; index < this.stack.length; index++) {
            var element = this.stack[index];
            stackString += element;
        }
        return stackString;
    };
    Stack.prototype.printTable = function () {
        console.table(this.stack);
    };
    Stack.prototype._toString = function () {
        return Object.prototype.toString;
    };
    return Stack;
}());
